package com.tjjingpan.fragmentbestpractice.learnkotlin

class Money(val value:Int) {

    //使用运算符重载实现两个Money对象相加的功能
    operator fun plus(money:Money):Money{
        val sum = value + money.value
        return Money(sum)
    }

    //Money对象直接和数字相加
    operator fun plus(newValue:Int):Money{
        val sum = value + newValue
        return Money(sum)
    }
}